package com.itheima.health.util;

import org.springframework.util.DigestUtils;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Tools {
    /**
     * 对字符串进行md5加密
     * @param string
     * @return
     */
    public static String Md5(String string){

        return  DigestUtils.md5DigestAsHex(string.getBytes());
    }

    /**
     * 返回当前时间
     */
    public static String getDateTime(){

        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String format = now.format(dateTimeFormatter);

        return format;
    }
}
